﻿
@{
    ViewBag.Title = "调价历史";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<form id="form1">
    <div class="panel panel-default" >
        <div class="panel-heading">
            筛选条件
        </div>
        <div style="padding: 2px;padding-right:20px;">
            <table class="form">
                <tr>
                    <th class="formTitle">关键字</th>
                    <td class="formValue">
                        <input type="text" id="txtINPUTCODE" class="form-control" placeholder="物资拼音/名称" />
                    </td>
                    <th class="formTitle">执行时间</th>
                    <td class="formValue">
                        <input id="txtStartTime" type="text" class="form-control input-wdatepicker" value="@DateTime.Now.AddDays(-31).ToString("yyyy-MM-dd 00:00:00")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                    </td>
                    <th class="formTitle">至</th>
                    <td class="formValue">
                        <input id="txtEndTime" type="text" class="form-control input-wdatepicker" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                    </td>
                    <td class="formValue">
                        <input type="button" id="btn_search" class="btn btn-primary btn-md" value="查询" style="width:55px;margin-left:30%;" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="gridPanel" >
        <table id="gridYPInfoList"></table>
        <div id="gridPager" rel="form1"></div>
    </div>
</form>

<script>
    $(function () {
        gridYPInfoList();
    });

    function gridYPInfoList() {
        var $gridYpInfoList = $("#gridYPInfoList");
        $gridYpInfoList.dataGrid({
            url: "/ProductManage/PriceAdjustment/SelectAdjustPriceHistoryList",
            postData: getSearchPostData(),
            height: $(window).height() - document.getElementById('gridYPInfoList').offsetTop - 70,
            colModel: [
                { label: '类别', name: 'lbmc', width: 80, align: 'left' },
                { label: '物资名称', name: 'wzmc', width: 120, align: 'left' },
                { label: '规格', name: 'gg', width: 100, align: 'left' },
                {
                    label: '原零售价', name: 'ylsj', width: 70, align: 'right',
                    formatter: function (val) {
                        return val.toFixed(4);
                    }
                },
                {
                    label: '新零售价', name: 'lsj', width: 70, align: 'right',
                    formatter: function (val) {
                        return val.toFixed(4);
                    }
                },
                { label: '定价单位', name: 'dwmc', width: 70, align: 'center' },
                { label: '转化因子', name: 'zhyz', width: 70, align: 'center' },
                { label: '调整文件', name: 'tzwj', width: 80, align: 'left' },
                { label: '生产厂家', name: 'supplierName', width: 120, align: 'left' },
                { label: '提交人员', name: 'CreatorCode', width: 100, align: 'left' },
                { label: '执行时间', name: 'zxsj', width: 100, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i', newformat: 'Y-m-d H:i' } },
                { label: 'productId', name: 'productId', hidden: true },
                { label: 'wztjId', name: 'wztjId', hidden: true }
            ],
            multiselect: false,
            pager: "#gridPager",
            sortname: 'zxsj desc',
            viewrecords: true
        });

        $("#btn_search").click(function () {
            if ($("#txtStartDate").val() > $("#txtEndDate").val()) {
                $.modalAlert("开始日期晚于结束日期", 'warning');
                return;
            }

            $gridYpInfoList.jqGrid('setGridParam', {
                postData: getSearchPostData()
            }).trigger('reloadGrid');
        });
    }
    //查询条件
    function getSearchPostData() {
        var inputCode = $("#txtINPUTCODE").val();
        var startTime = $("#txtStartTime").val();
        var endTime = $("#txtEndTime").val();
        return { inputCode: inputCode, startTime: startTime, endTime: endTime };
    };
</script>



